package com.cctc.security.controller;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.annotation.Secured;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import redis.clients.jedis.ShardedJedis;
import redis.clients.jedis.ShardedJedisPool;

@Controller
@RequestMapping("/demo")
public class DemoController
{
    private static  final Log log=LogFactory.getLog(DemoController.class);
    @Autowired
    private ShardedJedisPool shardedJedisPool;
    
    @RequestMapping(value = "/image.html", method = RequestMethod.GET)
    //@Secured("ROLE_ADMIN")
    public String image()
    {
        ShardedJedis jedis = shardedJedisPool.getResource();
        //jedis.get(key); //从redis服务器获取值    
        jedis.set("s121213", "1234567890asdfghjklqwertyuizxcvbm"); //将值保存到redis服务器    
        log.debug(jedis.get("s121213"));
        //从redis服务器获取值    
        return "resourse/jsp/2";
    }
    
    @Secured("ROLE_ADMIN")
    @RequestMapping(value = "/anyChart.html")
    public String anyChart()
    {
        return "resourse/jsp/AnyChart";
    }
    //
    //	@RequestMapping("/index/{username}/{id}.html")
    //	public String index(@PathVariable("username") String username, @PathVariable("id") String id) {
    //		System.out.println(username);
    //		//   System.out.println(id);
    //		return "jsp/user";
    //	}
    //
    //	@Secured("ROLE_ADMIN")
    //	@RequestMapping("/{username}.html")
    //	//@ModelAttribute("user") User user
    //	public String getDetailUser(@PathVariable("username") String username, ModelMap model) {
    //		model.addAttribute(userService.getUserByName(username));
    //		return "jsp/user";
    //	}
    
}
